home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 514 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: news.clark.net!not-for-mail
  2. From: gusty@clark.net (Harlan Messinger)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Strange (to me) notation - little help?
  5. Date: 4 Jan 1996 22:07:58 GMT
  6. Organization: Clark Internet Services, Inc., Ellicott City, MD USA
  7. Message-ID: <4chj3u$l6s@clarknet.clark.net>
  8. References: <30EB32AC.2836@sierra.net> <4cg4bh$hp1@werple.net.au>
  9. NNTP-Posting-Host: explorer.clark.net
  10. Mime-Version: 1.0
  11. Content-Type: TEXT/PLAIN; charset=ISO-8859-1
  12. Content-Transfer-Encoding: 8bit
  13. X-Newsreader: TIN [UNIX 1.3 950726BETA PL0]
  14.  
  15. David White (davidw@werple.net.au) wrote:
  16. : The colon introduces the constructor's initializer list, within which you
  17. : can initialize the base class constructor and any member objects. For
  18. : consistency with the initialization syntax used for user-defined types,
  19. : built-in types may use the same syntax, e.g., int x(5) creates an int and
  20. : gives it an initial value of 5. In your example, an initializer list is
  21. : not required; initialization could have been deferred to the c'tor body.
  22. : However, there are many cases in which an initializer list is necessary,
  23. : such as the construction of base class or member objects that do not have
  24. : default constructors, and reference members. For example: 
  25.  
  26. Also, constant member data have to be initialized this way.
  27.